<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>内置对象</title>
    <meta charset="UTF-8"/>
  <script type="text/javascript">
  	window.onload = function(){
		var but = document.getElementById('but');
		var but2 = document.getElementById('but2');
		 
		var times; 
		var i =1;
		but.onclick = function(){
			this.disabled = true;
				times = setInterval(function(){
					console.log('you can do this ',i);
					i++;
				},100);
		//times = setTimeout("alert('you can')",3000);//设置延时
		}
		 
		but2.onclick = function(){
			but.disabled = false;//暂停延时
			clearInterval(times);
			//clearTimeout(times);//清除延时
		}
		
		/*eval('alert (34*(56/3))');计算结果*/
		/*alert(res);*/
		
		/*console.log(Math.floor(42.78));向下取整*/
		
		/*console.log(Math.ceil(902.342));向上取整*/
		
		/*console.log(Math.min(34,43.3,12.1,13,1));取最小值*/
		
		/*console.log(Math.max(34,43.3,12.1,13,1));取最大值*/
		
		/*console.log(Math.round(5.4));四舍五入*/
		
		/*console.log(parseInt(Math.random()*9000+1000));随机数取整数*/
		
		/*console.log(Math.random()*9+1);取10到1之间的数字*/
		
		/*console.log(Math.random());取随机数*/
	};
  </script>
 </head>
 <body>
<button id='but'>按钮</button>
<button id='but2'>按钮2</button>

 </body>
</html>
